package com.jsu.user.controller.v1;

import com.jsu.user.service.impl.AppLoginServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.example.model.common.dtos.ResponseResult;
import org.example.model.user.dto.WXAuth;
import org.example.utils.common.JwtUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RestController
@Api(tags = "小程序登录接口")
@RequestMapping("/v1/app/login")
public class AppLoginController {
    @Autowired
    private AppLoginServiceImpl appLoginService;

    @ApiOperation(value = "获取sessionId")
    @GetMapping("/sessionId/{code}")
    public ResponseResult getSessionId(@PathVariable("code") String code){
        return appLoginService.getSessionId(code);
    }


    @ApiOperation(value = "微信授权登录")
    @PostMapping("/authLogin")
    public ResponseResult authLogin(@RequestBody WXAuth wxAuth) {
        return appLoginService.authLogin(wxAuth);
    }
}
